import listnode.ListNode;

public class _0313_删除排序链表重复元素 {
    public static ListNode deleteDuplicates(ListNode head) {
        ListNode cur = head;
        while (cur != null && cur.next != null) {
            if (cur.val == cur.next.val) {
                cur.next = cur.next.next;
            }else {
                cur = cur.next;
            }
        }
        return head;
    }


    public static void main(String[] args) {
        ListNode l = new ListNode(1);
        ListNode l1 = new ListNode(1);
        ListNode l2 = new ListNode(2);
        ListNode l3 = new ListNode(3);
        ListNode l4 = new ListNode(3);
        l.next = l1;
        l1.next = l2;
        l2.next = l3;
        l3.next = l4;

        System.out.println(deleteDuplicates(l));

    }
}
